luci-app-attendedsysugprade: allow to reinstall image
authorPaul Spooren <[email protected]>
Tue, 7 Jun 2022 12:23:59 +0000 (14:23 +0200)
committerPaul Spooren <[email protected]>
Fri, 29 Jul 2022 15:04:12 +0000 (17:04 +0200)
Now it's possible to re-install the currently running version in
advanced mode. This can be useful when installing packages via `opkg`
and then requesting the firmware with the packages stored in squashfs.

FIXES: https://github.com/openwrt/luci/issues/5809

Signed-off-by: Paul Spooren <[email protected]>
(cherry picked from commit fd72e1c23ef1569fd8f8ab71bdcb4a94f802435a)

applications/luci-app-attendedsysupgrade/htdocs/luci-static/resources/view/attendedsysupgrade/overview.js

index 1b794545e20b672bd59ba5f9b9f2ee2c54e5cc88..cac75d7f1df92f1a49c8a09f87234c1ab530d6a9 100644 (file)
@@ -341,6 +341,11 @@ return view.extend({
                                        }
                                }
 
+                               // allow to re-install running firmware in advanced mode
+                               if (this.data.advanced_mode == 1) {
+                                       candidates.unshift([version, revision])
+                               }
+
                                if (candidates.length) {
                                        var m, s, o;
 
@@ -357,7 +362,12 @@ return view.extend({
                                        s = map.section(form.NamedSection, 'request', '', '', 'Use defaults for the safest update');
                                        o = s.option(form.ListValue, 'version', 'Select firmware version');
                                        for (let candidate of candidates) {
-                                               o.value(candidate[0], candidate[1] ? `${candidate[0]} - ${candidate[1]}` : candidate[0]);
+                                               if (candidate[0] == version && candidate[1] == revision) {
+                                                       o.value(candidate[0], _('[installed] %s')
+                                                               .format(candidate[1] ? `${candidate[0]} - ${candidate[1]}` : candidate[0]));
+                                               } else {
+                                                       o.value(candidate[0], candidate[1] ? `${candidate[0]} - ${candidate[1]}` : candidate[0]);
+                                               }
                                        }
 
                                        if (this.data.advanced_mode == 1) {